package test;

public class Demo8 {

    public static void main(String[] args) {
        Thread thread1=new Thread(()->{
            for(int i=0;i<2;i++){
                System.out.println("Hello Thread");
            }
        });

        thread1.start();
        System.out.println(thread1.isDaemon());//false 说明他不是守护线程

        Thread thread2=new Thread(()->{
            for(int i=0;i<2;i++){
                System.out.println("Hello Thread");
            }
        });
        thread2.setDaemon(true);
        thread2.start();

        System.out.println(thread2.isDaemon());//true
    }
}
